package com.jia.config;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class ConfigBean {
    @Bean
    @LoadBalanced // 负载均衡
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }

    /*
     * IRule
     *   AvailabilityFilteringRule //会先过滤掉跳闸的服务 或者访问故障 剩余的进行轮询
     *   RoundRobinRule // 轮询
     *   RandomRule //随机
     *   RetryRule // 先轮询，如果失败会在指定的世界内重试
     *
     * */

    /*@Bean
    public IRule myIRule(){
        return new RandomRule();
    }*/


}
